import { useState, useEffect } from "react";
import { getChannelApi } from "../apis";

const useChannel = () => {
  const [channelList, setChannelList] = useState([]);

  const getChannel = async () => {
    const res = await getChannelApi();
    setChannelList(res?.data?.channels);
  };

  useEffect(() => {
    getChannel();
  }, []);

  return { channelList };
};

export { useChannel };
